﻿namespace Acoris.Document
{
    public interface IContentSegment
    {
        /// <summary>
        /// 获取当前内容段的格式
        /// </summary>
        IContentFormat Format { get;}

        /// <summary>
        /// 获取当前内容长度
        /// </summary>
        int Length { get; }

        /// <summary>
        /// 应用内容段样式
        /// </summary>
        /// <param name="format"></param>
        void ApplyFormat(IContentFormat format);

        /// <summary>
        /// 清除内容段样式
        /// </summary>
        void ClearFormat();

        /// <summary>
        /// 移除指定范围的内容
        /// </summary>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        void RemoveRange(int offset,int count);

        /// <summary>
        /// 替换指定范围的内容
        /// </summary>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        /// <param name="format"></param>
        void ReplaceRange(int offset,int count, IContentSegment content);

        /// <summary>
        /// 在指定位置插入内容
        /// </summary>
        /// <param name="offset"></param>
        /// <param name="content"></param>
        void InsertRange(int offset, IContentSegment content);

        /// <summary>
        /// 在指定位置分割内容段
        /// </summary>
        /// <param name="offset"></param>
        /// <returns></returns>
        IContentSegment Split(int offset);
    }
}
